import { window, Progress, CancellationToken } from 'vscode'

const progress = (title: string, work: Function, callback: Function) => {
    window.withProgress({
        cancellable: false,
        location: 15,
        title
    },
        async (progress: Progress<{ increment: number, message: string }>,
            token: CancellationToken): Promise<any> => {
            return await work()
        }).then((data: any) => {
            callback(data)
        })
}

export default progress